package com.itheima.service;

import com.itheima.domain.User;
import org.springframework.transaction.annotation.Transactional;

@Transactional(readOnly = true)
public interface UserService {
    /**
     * 登录
     * @param username   用户名
     * @param password   密码
     * @return
     */
    public User getByUserNameAndPassword(String username, String password);

    /**
     * 注册验证/用户修改查询
     * @param username 用户名
     * @return
     */
    public User getByUserName(String username);

    /**
     * 注册
     * @param user
     * @return
     */
    @Transactional(readOnly = false)
    public boolean save(User user);

    /**
     * 修改用户
     * @param user
     * @return
     */
    @Transactional(readOnly = false)
    public boolean update(User user);

    /**
     * 用户注销
     * @param id
     * @return
     */
    @Transactional(readOnly = false)
    public boolean delete(Integer id);

    /**
     * 查询权限
     * @param username
     * @return
     */
    User findByUserName(String username);
}
